/***************************************************************************
 *   Copyright (C) 2007 by Marcin Swiechowicz   *
 *   marcin.swiechowicz@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef KDCAUDIOVIDEOEDITOR_H
#define KDCAUDIOVIDEOEDITOR_H

#include <kdcmovie.h>
#include <kdcmoviegroup.h>
#include <kdcnamespace.h>
#include "kdcaudiocodecdelegate.h"
#include "kdcaudiobitratedelegate.h"
#include "kdcstreammodedelegate.h"
#include "kdcaudiodelaydelegate.h"
#include "kdcvideocodecdelegate.h"
#include "kdcvideobitratedelegate.h"
#include "kdcresolutiondelegate.h"
#include "kdcvideoformatdelegate.h"
#include "kdcaspectratiodelegate.h"
#include "kdcmoviefpsdelegate.h"
#include "kdcaudiochanneldelegate.h"

#include <QResizeEvent>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QPointer>

class KDCAudioVideoEditor : public QTreeWidget
{
Q_OBJECT
public:
	KDCAudioVideoEditor( QWidget *parent = 0 );
	~KDCAudioVideoEditor();
	void setCurrentMovie( KDCMovie *movie );
	void setCurrentMovie( KDCMovieGroup *movie );
public slots:
	void readSettings();
	void clean();
private slots:
	void slotOpenEditor( QTreeWidgetItem *, int );
	void slotAudioBitrateChanged( int );
	void slotAudioCodecChanged( KDC::AudioCodec );
	void slotDelayChanged( int );
	void slotModeChanged( KDC::StreamMode );
	void slotItemClicked( QTreeWidgetItem * , int );
	void slotCurrentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * );
	void slotVideoBitrateChanged( int );
	void slotVideoCodecChanged( KDC::VideoCodec );
	void slotResolutionChanged( int, int );
	void slotFormatChanged( KDC::VideoFormat );
	void slotAspectChanged( KDC::AspectRatio );
	void slotCloseEditor( QWidget *, QAbstractItemDelegate::EndEditHint );
	void slotFpsChanged( double );
	void slotChannelChanged( int );
protected:
	void resizeEvent( QResizeEvent * );
private:
	QPointer<KDCMovie> p_movie;

	KDCAudioCodecDelegate *p_audioCodecDelegate;
	KDCAudioBitrateDelegate *p_audioBitrateDelegate;
	KDCAudioDelayDelegate *p_delayDelegate;
	KDCStreamModeDelegate *p_modeDelegate;
	KDCVideoCodecDelegate *p_videoCodecDelegate;
	KDCVideoBitrateDelegate *p_videoBitrateDelegate;
	KDCAspectRatioDelegate *p_aspectDelegate;
	KDCVideoFormatDelegate *p_formatDelegate;
	KDCResolutionDelegate *p_resolutionDelegate;
	KDCMovieFpsDelegate *p_fpsDelegate;
	KDCAudioChannelDelegate *p_channelDelegate;
};
#endif
